import { defineStore } from 'pinia'
import { signIn } from '../api/login/index'
export const useLogin = defineStore("Login",
  {
    state: () => {
      return {
        account:'',
        name:''
      }
    },
    getters: {
    },
    actions: {
      async setSignIn(rty, kty) {
        if (this.state) {
          return this.state;
        }
        let data = await signIn({
          account: rty,
          password: kty
        });
        this.signIn = data;
        return data;
      }
    },
    persist: {
      enabled: true, // 开启缓存  默认会存储在本地sessionstorage
      storage: localStorage, // 缓存使用方式
    }
  }
)
